<script>
	global.isLogin = function() {
		try {
			var isLogin = uni.getStorageSync('isLogin');
		} catch (e) {
			//TODO handle the exception
		}
		if (isLogin == '') {
			return "false";
		} else {
			return isLogin;
		}
	}
	// 	var res = global.isLogin();
	console.log('缓存登陆状态', isLogin)
	var isLogin = global.isLogin();
	if (isLogin != "true") {
		setTimeout(function(){
			uni.navigateTo({
				url: "/pages/layout/login"
			});	
		}, 500)
	}
	export default {
		onLaunch: function() {
			uni.setStorageSync("token","")
		}
		/* onShow: function() {
			console.log('App Show')
			getData(d) {
				var oType = d.type
				uni.request({
					url: d.url,
					method: 'POST',
					data: d.data,
					success: res => {
						if (res.data.status == 0) {
							uni.showToast({
								mask: true,
								image: "/static/wrong.png",
								title: "请先登录",
								duration: 1000
							})
							setTimeout(() => {
								uni.reLaunch({
									url: "/pages/layout/login"
								})
							}, 1000)
							return
						}
						if (res.data.code == "success") {
							if (oType == "") {
								this.xx = res.data.data
							}
						}
					},
					fail: () => {},
					complete: () => {}
				});
			}
		},
		onHide: function() {
			console.log('App Hide')
		} */

	}
</script>
<style lang="less">
	/*每个页面公共css */
	/* 行 省略 */
	.one_ellipsis {
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	.two_ellipsis {
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 2;
	}

	/* 注册登陆 输入框 */
	page {
		font-family: 'PingFang-SC-Medi';
		font-size: 16px;
	}

	.form_item {
		padding: 0 10px;
		background-color: #fff;

		.ipt_item {
			// width: 100%;
			height: 44px;
			display: flex;
			align-items: center;
			border-bottom: 1upx solid #ddd;
			background-color: #fff;

			.input_bx {
				flex: 1;

				input {
					line-height: 1.5;
				}
			}

			// 输入密码图标
			.code_icon {
				overflow: hidden;
				width: 60px;
				height: 20px;
				text-align: center;

				image {
					display: inline-block;
					width: 20px;
				}
			}

			// 发送验证码
			.send_code {
				width: 100px;
				height: 30px;
				display: flex;
				align-items: center;
				text-align: center;

				.text {
					width: 100%;
					text-align: center;
					font-size: 14px;
					color: #e278b9;
					border-left: 1px solid #ddd;
				}

				image {
					display: inline-block;
					vertical-align: middle;
					width: 100%;
					height: 36px;
					background-color: #DDDDDD;
				}
			}
		}
	}

	/* 表单按钮 */
	.form_btn {
		box-sizing: border-box;
		padding: 0 10px;
		width: 100%;
		height: auto;

		span {
			display: block;
			width: 100%;
			text-align: center;
			line-height: 42px;
			font-size: 18px;
			color: #fff;
			background-color: #901c63;
			border-radius: 6px;
		}
	}


	.header {
		position: fixed;
		top: 0;
		left: 0;
		overflow: hidden;
		z-index: 99999;
		padding-top: var(--status-bar-height);
		width: 100%;
		height: 44px;
		background-color: #fff;

		p {
			overflow: hidden;
			margin: 0 auto;
			width: 70%;
			text-align: center;
			white-space: nowrap;
			text-overflow: ellipsis;
			line-height: 44px;
			font-size: 18px;
			color: #333333;
		}

		.btn_back {
			image {
				position: absolute;
				top: calc(var(--status-bar-height) + 14px);
				padding: 0 10px;
				width: 10px;
				height: auto;
			}
		}

		.btn_search {
			image {
				position: absolute;
				top: calc(var(--status-bar-height) + 14px);
				right: 10px;
				width: 20px;
				height: auto;
			}
		}
	}

	// reset
	.navigator-hover {
		background-color: rgba(255, 255, 255, 0);
		opacity: 1;
	}

	// 设置页 标题
	.set_tt_bx {
		line-height: 3;
		padding: 0 10px;

		.tt_text {
			color: #901c63;
		}
	}

	// 设置页 栏目
	.com_item_link {
		padding: 0 10px;
		background-color: #fff;

		navigator {
			padding: 10px 0;
			display: flex;
			align-items: center;
			justify-content: space-between;
			border-bottom: 1upx solid #ddd;
		}

		.left {
			.l_text {}
		}

		.right {
			position: relative;
			display: flex;
			align-items: center;
			overflow: hidden;
			border-radius: 6px;

			.img_tx {
				position: relative;
				display: block;
				width: 60px;
				height: 60px;
			}

			.set_tou_text {
				position: absolute;
				top: 0;
				left: 0;
				right: 0;
				bottom: 0;
				line-height: 60px;
				text-align: center;
				background-color: rgba(0, 0, 0, 0.4);
				color: #fff;
			}

			.icon_r {
				image {
					display: block;
					width: 30px;
					height: 30px;
				}
			}

			.r_text {
				color: #808080;
			}
		}

		.first_item_bx {
			align-items: flex-start;
		}
	}

	.com_item {
		padding: 0 10px;
		background-color: #fff;

		.com_item_bx {
			padding: 10px 0;
			display: flex;
			align-items: center;
			justify-content: space-between;
			border-bottom: 1upx solid #ddd;

			.left {
				.l_text {}
			}

			.right {
				position: relative;
				display: flex;
				align-items: center;
				overflow: hidden;
				border-radius: 6px;

				.img_tx {
					position: relative;
					display: block;
					width: 60px;
					height: 60px;
				}

				.set_tou_text {
					position: absolute;
					top: 0;
					left: 0;
					right: 0;
					bottom: 0;
					line-height: 60px;
					text-align: center;
					background-color: rgba(0, 0, 0, 0.4);
					color: #fff;
				}

				.icon_r {
					image {
						display: block;
						width: 30px;
						height: 30px;
					}
				}

				.r_text {
					color: #808080;
				}
			}
		}

		.first_item_bx {
			align-items: flex-start;
		}
	}
</style>
